package com.celeritymq.connection;

public class CelerityMode {
	public static final int NONE = 0, WRITE = 2, READ = 4;
	private int mode;

	public CelerityMode(int mode) {
		this.mode = mode;
	}

	public CelerityMode() {
		this.mode = NONE;
	}

	void add(int cm) {
		this.mode = this.mode | cm;
	}

	void remove(int cm) {
		this.mode = this.mode & ~cm;
	}

	boolean canRead() {
		System.out.println("canRead, mode: " + this.mode);
		return (READ & this.mode) == READ;
	}

	boolean canWrite() {
		System.out.println("canWrite, mode: " + this.mode);
		return (WRITE & this.mode) == WRITE;
	}
}
